home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
351-375
/
disk_352
/
treewalk
/
rexx
/
backup.ftw
next >
Wrap
Text File
|
1992-05-06
|
2KB
|
66 lines
/*
* backup treewalk routine - gets treewalk to check the exclusions
* list, and then copies the files that need copying.
*
* Copyright (C) 1989, 1990 Mike Meyer
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
in = arg(1) || arg(2)
/* if it passes the basic filter, then do it to it */
'' getclip("daily.backup")
if rc = 0 then
return copy(in, 'backup'substr(in, index(in, ':')))
/* Copy things in :lib, always and forever */
if index(in, ':lib/') ~= 0 then
return copy(in, 'backup'substr(in, index(in, ':')))
return 0
/*
* copy - makes sure the directory is in place for the destination,
* then copies infile to outfile.
*/
copy: procedure
parse arg infile, outfile
address command
/* Is the directory there? */
outdex = lastpos('/', outfile)
do while outdex > 0
outdir = substr(outfile, 1, outdex - 1)
if exists(outdir) then break
outdex = lastpos('/', outfile, outdex - 1)
end
outdex = index(outfile, '/', outdex + 1)
do while outdex > 0
outdir = substr(outfile, 1, outdex - 1)
'makedir "'outdir'"'
outdex = index(outfile, '/', outdex + 1)
end
'copy "'infile'" to "'outfile'"'
'compress "'outfile'"' /* Copy to ram some day... */
return rc ~= 0
/*
* Log - log the message we've been given.
*/
log: procedure
parse arg message
logfile = 'logs:backup.log'
if ~open(file, logfile, 'Append') then do
say "Can't open" logfile', exiting!'
exit
end
call writeln file, date() time() || ':' message
call close file
return